package com.zhuoyue.biz.core.command.cmd.common.faa.base;

/**
 * @author wjming
 */

public enum TimeEnum {
    //20秒
    time1(20, "0014"),
    //30秒
    time2(30, "001E"),
    //60秒
    time3(60, "003C"),
    //90米哦啊
    time4(90, "005A"),
    //120秒
    time5(120, "0078");
    private int time;
    private String timeHex;


    TimeEnum(int time, String timeHex) {
        this.time = time;
        this.timeHex = timeHex;
    }

    public int getTime() {
        return time;
    }

    public String getTimeHex() {
        return timeHex;
    }

    /**
     * 根据Key得到枚举的Value
     * 普通for循环遍历，比较判断
     *
     * @param key
     * @return
     */
    public static String getTimeEnum(int key) {
        TimeEnum[] alarmGrades = TimeEnum.values();
        for (int i = 0; i < alarmGrades.length; i++) {
            if (alarmGrades[i].getTime() == key) {
                return alarmGrades[i].getTimeHex();
            }
        }
        return "";
    }
}
